package com.waimai.mobile.api;

import com.waimai.mobile.api.entity.Comment;
import com.waimai.mobile.api.entity.Food;
import com.waimai.mobile.api.entity.Order;
import com.waimai.mobile.api.entity.OrderStatus;
import com.waimai.mobile.api.entity.ReceiveAddress;
import com.waimai.mobile.api.entity.Restaurant;
import com.waimai.mobile.api.entity.User;
import com.waimai.mobile.api.model.ResponseModel;

import org.androidannotations.annotations.rest.Delete;
import org.androidannotations.annotations.rest.Get;
import org.androidannotations.annotations.rest.Post;
import org.androidannotations.annotations.rest.Put;
import org.androidannotations.annotations.rest.Rest;
import org.androidannotations.api.rest.RestClientHeaders;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

import java.util.List;

/**
 * Created by lin on 2015/6/17.
 */

@Rest(rootUrl = APIConst.ROOT_URL, converters = {MappingJackson2HttpMessageConverter.class})
public interface WaiMaiServer extends RestClientHeaders{

    @Post(APIConst.LOGIN)
    public ResponseModel<User> login(User user);

    @Post(APIConst.REGIST)
    public ResponseModel<User> regist(User user);

    @Put(APIConst.UPDATE_USER)
    public ResponseModel<User> updateUser(Integer userId, User user);


    //收货地址的操作
    /********************************************************************/

    @Get(APIConst.ADDRESSES)
    public ResponseModel<List<ReceiveAddress>> addresses(Integer userId);

    @Post(APIConst.ADD_ADDRESS)
    public ResponseModel<ReceiveAddress> address(Integer userId, ReceiveAddress address);

    @Put(APIConst.UPDATE_ADDRESS)
    public ResponseModel<ReceiveAddress> address(Integer userId, Integer addressId, ReceiveAddress address);

    @Delete(APIConst.DELETE_ADDRESS)
    public ResponseModel<ReceiveAddress> address(Integer userId, Integer addressId);

    /********************************************************************/

    @Post(APIConst.RESTAURANTS)
    public ResponseModel<List<Restaurant>> restaurants(String keyWords);

    @Get(APIConst.RESTAURANT_GET)
    public ResponseModel<Restaurant> resturant(Integer restaurantId);

    @Post(APIConst.RESTAURANT_CHECK)
    public ResponseModel<Restaurant> checkRestaurant(Integer restaurantId, Restaurant restaurant);

    @Get(APIConst.FOODS)
    public ResponseModel<List<Food>> foods(Integer restaurantId);

    @Get(APIConst.ORDERS)
    public ResponseModel<List<Order>> orders(Integer userId);

    @Post(APIConst.ADD_ORDER)
    public ResponseModel<Order> submitOrder(Integer restaurantId, Order order);

    @Get(APIConst.ORDER_GET)
    public ResponseModel<Order> order(Integer userId, Integer orderId);

    @Put(APIConst.UPDATE_ORDER)
    public ResponseModel<OrderStatus> orderUpdate(Integer restaurantId, Integer orderId, OrderStatus orderStatus);

    @Post(APIConst.COMMENTS)
    public ResponseModel<List<Comment>> comments(Integer restaurantId, int commentLevel);

    @Post(APIConst.ADD_COMMENT)
    public ResponseModel<Comment> submitComment(Integer userId, Integer orderId, Comment comment);



}
